void per_1sec()
{
    //时间
    timeClient.update();
    String timeStr = timeClient.getFormattedTime();
    Serial.println(timeStr);
    h = (timeStr[0] - '0') * 10 + (timeStr[1] - '0');
    //倒计时设备
    if (data_stream_value_rw[4] > 0)
        data_stream_value_rw[4]--;
    //led和刷机检测
    if (data_stream_value_rw[9] == 0)
    {
        //autoLED

        if (h >= timeLedOn[0] && h < timeLedOn[1])
        {
            ledset = 100;
        }
        else
        {
            ledset = 4;
        }
    }
    else
    {
        if (data_stream_value_rw[9] <= 100)
            ledset = data_stream_value_rw[9];
        else if (data_stream_value_rw[9] == 101)
        {
            OTAtrig = 1;
        }
        else if (data_stream_value_rw[9] == 102)
        {
            esp_restart();
        }
    }
    //数据上传Onenet
    pidpowerOut = (pidOutput2 / WindowSize) * 100;
    data_stream_value_r1[0] = TMP;
    data_stream_value_r1[1] = PH;
    data_stream_value_r1[2] = pidpowerOut;
    char tmp[225];
    snprintf(tmp, sizeof(tmp), "{\"%s\":%.2f,\"%s\":%.2f,\"%s\":%.1f,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d,\"%s\":%d}",
             data_stream_name_r1[0], data_stream_value_r1[0], data_stream_name_r1[1], data_stream_value_r1[1],
             data_stream_name_r1[2], data_stream_value_r1[2],
             data_stream_name_r2[0], data_stream_value_r2[0], data_stream_name_r2[1], data_stream_value_r2[1],
             data_stream_name_r2[2], data_stream_value_r2[2], data_stream_name_r2[3], data_stream_value_r2[3],
             data_stream_name_rw[0], data_stream_value_rw[0], data_stream_name_rw[1], data_stream_value_rw[1],
             data_stream_name_rw[2], data_stream_value_rw[2], data_stream_name_rw[3], data_stream_value_rw[3],
             data_stream_name_rw[4], data_stream_value_rw[4], data_stream_name_rw[5], data_stream_value_rw[5],
             data_stream_name_rw[6], data_stream_value_rw[6], data_stream_name_rw[7], data_stream_value_rw[7],
             data_stream_name_rw[8], data_stream_value_rw[8], data_stream_name_rw[9], data_stream_value_rw[9]);
    pack_msg(tmp);
    //蛋分延时计时
    if (bumpOn == 1 && curbumpdelay < 600)
    {

        curbumpdelay++;
    }
    display.clearDisplay();
    display.setTextSize(1);      // Normal 1:1 pixel scale
    display.setTextColor(WHITE); // Draw white text
    char line1[20] = {""};
    sprintf(line1, "%s PH=%.2f", timeStr, PH);
    display.setCursor(0, 0);
    display.println(line1);
    //display.display();
    char line2[20] = {""};
    sprintf(line2, "TMP=%05.2f POW=%dW", TMP, (int)pidpowerOut);
    display.setCursor(0, 10);
    display.println(line2);
    //display.display();
    char line3[20] = {""};
    sprintf(line3, "%d %d %d %d %d %d %d %d", data_stream_value_rw[0], data_stream_value_rw[1], data_stream_value_rw[2], data_stream_value_rw[3], data_stream_value_rw[4], data_stream_value_rw[5], data_stream_value_rw[6], data_stream_value_rw[7]);
    display.setCursor(0, 20);
    display.println(line3);
    //display.display();
    char line4[20] = {""};
    sprintf(line4, "%d %d %d %d  d=%d", data_stream_value_r2[0], data_stream_value_r2[1], data_stream_value_r2[2], data_stream_value_r2[3], curbumpdelay);
    display.setCursor(0, 30);
    display.println(line4);
    display.display();
    delay(1);
}
void per_01sec()
{
    if (debugMod != 1)
        readADC();
    autoled();
    WRead();
    JDctrl();
    if (now_s % 10 == 0)
        per_1sec();
    if (now_s % 50 == 0)
        per_5sec();
    now_s++;

    if (powerstart < 100)
    {
        powerstart++;
    }
    if (powerstart == 100)
    {
        PowerInit();
        powerstart++;
    }
    if (powerstart == 101)
        PowerCtrl();
}
void per_5sec()
{
    if (!client.connected())
    {
        reconnect();
    }
}
